package org.monkey.example.generate.entity.convert;


import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.factory.Mappers;
import org.monkey.example.generate.entity.dto.GenerateTestDto;
import org.monkey.example.generate.entity.form.GenerateTestAddForm;
import org.monkey.example.generate.entity.form.GenerateTestSaveForm;
import org.monkey.example.generate.entity.form.GenerateTestUpdateForm;
import org.monkey.example.generate.entity.po.GenerateTestPo;
import org.monkey.example.generate.entity.vo.GenerateTestVo;

@Mapper(componentModel = "spring",nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface GenerateTestConvert {

  GenerateTestConvert INSTANT = Mappers.getMapper(GenerateTestConvert.class);

  @Mappings({
      @Mapping(target = "totalAmount",expression = "java(org.monkey.common.constant.util.DoubleUtil.getDouble(source.getTotalAmount()))")
  })
  GenerateTestVo dto2Vo(GenerateTestDto source);
  GenerateTestDto po2Dto(GenerateTestPo source);
  @Mappings({
      @Mapping(target = "totalAmount",expression = "java(org.monkey.common.constant.util.DoubleUtil.getBigDecimal(source.getTotalAmount()))")
  })
  GenerateTestDto addForm2Dto(GenerateTestAddForm source);

  GenerateTestPo dto2Po(GenerateTestDto source);
  @Mappings({
      @Mapping(target = "totalAmount",expression = "java(org.monkey.common.constant.util.DoubleUtil.getBigDecimal(source.getTotalAmount()))")
  })
  GenerateTestDto updateForm2Dto(GenerateTestUpdateForm source);
  @Mappings({
      @Mapping(target = "totalAmount",expression = "java(org.monkey.common.constant.util.DoubleUtil.getBigDecimal(source.getTotalAmount()))")
  })
  GenerateTestDto saveForm2Dto(GenerateTestSaveForm source);


}
